public class TestDemo2 {

    //求1+2+....n
    public static int sum(int n) {
        if (n == 1) {
            return 1;
        }
        return n + sum(n - 1);
    }
    public static int add(int n){
        if(n<10){
            return n;
        }
        return add(n/10)+n%10;
    }
    public static int Fib(int n){
        if(n==1||n==2){
            return 1;
        }
        return Fib(n-1)+Fib(n-2);
    }
    public static void main(String[] args) {
        int ret=sum(4);
        System.out.println(ret);
        System.out.println(add(123));
        System.out.println(Fib(100));
    }
}
